package com.artisan.requestbodycache.config;

import com.artisan.requestbodycache.interceptor.ParamValidationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web MVC 配置
 * 注册拦截器
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private ParamValidationInterceptor paramValidationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(paramValidationInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/health"); // 排除健康检查接口
    }
}

